Attribute VB_Name = "Sh_Utilidades"
Dim Recset As New ADODB.Recordset
Dim Conn As New ADODB.Connection

Public Sub Conexion_Shape(F As Form)
On Error GoTo Mio
    Dim connstring As String
    connstring = "Provider=MSDataShape.1;Extended Properties=" & Chr(34) & _
               "Provider=SQLOLEDB.1;Password=;Persist Security Info=True;" & _
               "User ID=sa;Initial Catalog=Premium_Colqui;Data Source=127.0.0.1" & _
               Chr(34) & ";Persist Security Info=False;Data Provider=MSDASQL"
    Set Conn = New ADODB.Connection
    Conn.Open connstring
    Exit Sub
Mio:
    MsgBox Err.Description
End Sub

Public Sub Crear_Recorset(F As Form, cTipo$, cSolicitud$)
On Error GoTo Mio
    Set Recset = New ADODB.Recordset
    strSQL = "SHAPE {Exec Spu_Com_Trae_ArtiPro '" & gbCodEmpresa$ & "','" & gbAno$ & "','" & cTipo$ & "','" & cSolicitud$ & "'}" & _
             "APPEND ({Exec Spu_Com_Trae_ProArti '" & gbCodEmpresa$ & "','" & gbAno$ & "','" & cTipo$ & "','" & cSolicitud$ & "'}" & _
             "AS HIJO RELATE CO08KEY TO Articulo)"
    
    Recset.Open strSQL, Conn
    
    Set F.MfDetalle.DataSource = Recset
    Call Formato_Columnas(F)
    Exit Sub
Mio:
    MsgBox Err.Description
End Sub

Public Sub Formato_Columnas(F As Form)
    With F.MfDetalle
        .ColWidth(0) = "229"
        .ColWidth(1) = "950"
        .ColWidth(2) = "2500"
        .TextMatrix(0, 1) = "Articulo"
        .TextMatrix(0, 2) = "Descripcion"
    End With
End Sub

Public Sub Pintar_FilaCopia(F As Form)
On Error GoTo ErrRango
  Dim i As Integer, ii, intFila, intFilaP
  With F.mfDetalleApro
        For intFila = 1 To .Rows - 1
            If .TextMatrix(intFila, 13) = "1" Then
                intFilaP = 3
                For ii = 3 To 15
                    .Col = intFilaP
                    .CellBackColor = &HFFE1C4    '&H80FF&
                    intFilaP = intFilaP + 1
                Next ii
            End If
            Call Siguiente(F.mfDetalleApro)
        Next
  End With
  Exit Sub
ErrRango:
  MsgBox Err.Description
End Sub

Public Sub Pintar_Fila(F As Form)
On Error GoTo ErrRango
  Dim i As Integer, ii, intFila, intFilaP
  With F.MfDetalle
        For intFila = 1 To .Rows - 1
            If .TextMatrix(intFila, 12) = "1" Then
                 intFilaP = 3
                For ii = 3 To 12
                    .Col = intFilaP
                    .CellBackColor = &HFFE1C4    '&H80FF&
                    intFilaP = intFilaP + 1
                Next ii
            End If
            Call Siguiente_Msh(F.MfDetalle)
        Next
  End With
  Exit Sub
ErrRango:
  MsgBox Err.Description
End Sub


Public Sub Ancho_Fila(F As Form)
On Error GoTo ErrRango
  Dim i As Integer, ii, intFila, intFilaP
  With F.MfDetalle
        For intFila = 1 To .Rows - 1
            If .TextMatrix(intFila, 12) = "1" Then
                For ii = 0 To .Cols - 1
                    intFilaP = 12
                    .Col = intFilaP
                    .CellBackColor = &HFFE1C4    '&H80FF&
                Next ii
            End If
            Call Siguiente_Msh(F.MfDetalle)
        Next
  End With
  Exit Sub
ErrRango:
  MsgBox Err.Description
End Sub

